# Maintainer: Ray Donnelly <mingw.android@gmail.com>

_realname=atom-shell
pkgbase=mingw-w64-${_realname}-git
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=r2873.1a80bc7
pkgrel=1
pkgdesc='Cross-platform desktop application shell (mingw-w64)'
source=("${_realname}-${CARCH}"::"git+https://github.com/atom/atom-shell.git#branch=master"
        "0001-python-python2.patch"
        "0002-Add-ninja-option.patch")
arch=('any')
url='https://atom.io'
license=('MIT')
options=()
sha256sums=('SKIP')
makedepends=("${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-python2"
             "git")

pkgver() {
  cd "$srcdir"/${_realname}-${CARCH}
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir"/${_realname}-${CARCH}
  git am "$srcdir"/0001-python-python2.patch
  git am "$srcdir"/0002-Add-ninja-option.patch
}

build() {
  cd "$srcdir"/${_realname}-${CARCH}
  export GYP_GENERATORS=ninja
# Downloads atl, directxsdk, vs2012_crt.
  ./script/bootstrap.py
  mkdir -p out/Release
  ./script/build.py \
    --ninja ${MINGW_PREFIX}/bin/ninja.exe \
    --configuration Release
}

package() {
  echo "NYI"
}

sha256sums=('SKIP'
            '5b0ad589432c93939b2e25d6f20beeeeda7ee79bafca81481169f17e4d246b08'
            '68145f10ebbff24f81eccf9998d2180e0b92586b4549a38e66deea547ffb4f11')
